#include<bits/stdc++.h>

#define rp(i,n) for(int i=0;i<n;++i)

struct node
{
	int val,index;
};

using namespace std;

std::vector<node> v1(700000),v2(700000);

int main(){
	int n;scanf("%d", &n);
	int size = pow(2,n);
	rp(i,size){
		scanf("%d", &v1[i].val);
		v1[i].index = i +1 ;
	}
	int ans;
	int size1 = size, size2;
	if(size1 == 2){
		ans = v1[0].val < v1[1].val ? v1[0].index : v1[1].index;
	}else{
		while(1){
			size2 = 0;
			for(int i = 0 ; i < size1; i += 2){
				if(v1[i].val > v1[i+1].val){
					v2[size2]=v1[i];
				}else{
					v2[size2]=v1[i+1];
				}
				++size2;
			}
			// rp(i,size2) printf("%d ", v2[i].val);
			// printf("\n");
			if(size2 == 2){
				ans = v2[0].val < v2[1].val ? v2[0].index : v2[1].index;
				break;
			}

			size1 = 0;
			for(int i = 0 ; i < size2; i += 2){
				if(v2[i].val > v2[i+1].val){
					v1[size1]=v2[i];
				}else{
					v1[size1]=v2[i+1];
				}
				++size1;
			}
			// rp(i,size1) printf("%d ", v1[i].val);
			// printf("\n");
			if(size1 == 2){
				ans = v1[0].val < v1[1].val ? v1[0].index : v1[1].index;
				break;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}